Working with Images
What is an Image?
In the context of digital technology and computing, images are represented as a grid of pixels, with each pixel containing information about color and intensity.
Types of images supported by ImagesJS
- Currently ImageJS supports images with these characteristics:
TIFF | JPEG | PNG | |
---|---|---|---|
Bits per channel | 8 or 16 bits | 8 bits | 8 or 16 bits |
Bits per Alpha | 8 or 16 bits | N/A | 8 or 16 bits |
Compression | yes/no(may be destructive) | no(may be destructive) | yes |
Color Model | RGB and grayscale | RGB and grayscale | RGB and grayscale |
Can be loaded in this format | ✅ | ✅ | ✅ |
Can be saved in this format | ❌ | ✅ | ✅ |
Image coordinates
The origin point has coordinates (0,0) and is located in the top-left corner of an image.
So, if we want to get a certain pixel on the image we will be counting the distance from image's top-left corner.
//We will receive 20th row and 10th column
//from the top-left corner.
const pixel = image.getPixel(10, 20);
Properties
In ImageJS main properties of an image are:
width
height
data: typed array with information about image's pixels.
Color model: the abstract model of how pixel colors are formed.
Bit depth: number of bits allocated to each channel.
Number of channels/components: number of color channels that each pixel has. Grey image has one, RGB-type of image has three.
Metadata: data about data.
The latter ones matter most in features that involve two images, like hypotenuse method or subtraction method. It simply will not work if images are not compatible by bit depth, color model or size.
Features
Currently, there are several ways of processing an image:
Filtering: filters usually apply some sort of kernel to change an image.
Comparison: these features compare two images for further feature matching between the two.
Geometry: this part of ImageJS allows rotating and resizing an image.
Morphology: enables shape analysis and shape identification.

